#include "myLabel.h"

myLabel::myLabel(QWidget *parent) : QLabel(parent)
{

}

void myLabel::mouseMoveEvent(QMouseEvent *ev)
{
    if(clicked)
    {
        QPoint sub = ev->globalPos()-mousePos;
        QPoint add = QLabel::pos()+sub;
        QLabel::move(add);
        mousePos = ev->globalPos();
    }
}

void myLabel::mousePressEvent(QMouseEvent *ev)
{
    this->clicked = true;
    mousePos = ev->globalPos();
}

void myLabel::mouseReleaseEvent(QMouseEvent *ev)
{
    this->clicked = false;
}
